package com.bawei.library_common.adapter

import android.text.TextUtils
import android.widget.ImageView
import androidx.databinding.BindingAdapter
import com.bawei.library_base.BaseApplication
import com.bawei.library_common.CommonApplication

import com.bawei.library_common.utils.ImageUtils



class ImageAdapter {
    companion object{

        @BindingAdapter("imageUrl")
        @JvmStatic
        fun imageUrl(imageView: ImageView, url:String){
            if(!TextUtils.isEmpty(url)){
                ImageUtils.loadIntoImageView(BaseApplication.instance,url,imageView)
            }
        }

        @BindingAdapter("imageCircleUrl")
        @JvmStatic
        fun imageCircleUrl( imageView: ImageView, url:String){
            if(!TextUtils.isEmpty(url)){
                ImageUtils.loadCircleIntoImageView(BaseApplication.instance,url,imageView)
            }
        }

        @BindingAdapter("imageRoudendUrl")
        @JvmStatic
        fun imageRoudendUrl( imageView: ImageView, url:String){
            if(!TextUtils.isEmpty(url)){
                ImageUtils.loadRoundedIntoImageView(BaseApplication.instance,url,imageView)
            }
        }




    }

}